
#ifndef _ParticleEmitter_H_
#define _ParticleEmitter_H_

#include "Particle.h"
#include "../../Utils/Vector2D.h"

#include <vector>
#include <string>

class ParticleEmitter {

  public:
    ParticleEmitter(Vector2D emitter_position, Vector2D emit_velocity,  // properties of the emitter
                    float emit_rand_min, float emit_rand_max, 
                    unsigned particles_per_second,

                    float col_r, float col_g, float col_b, // properties of the particle being emitted
                    float life, float life_rand, 
                    float size, float size_rand, 
                    float life_decay, float life_decay_rand, 
                    float size_decay, float size_decay_rand,
                    std::string texture = "", bool flare_up=false);


    virtual ~ParticleEmitter();

    virtual std::vector<Particle> emit(void);

    virtual void stop(void);
    virtual void start(void);


    virtual void setEmitVelocity(Vector2D new_emit_velocity);
    virtual void setEmitterPosition(Vector2D pos);

  protected:

    bool active;   
    Vector2D position;
    Vector2D emit_velocity;
    float emit_rand_min, emit_rand_max;
    unsigned particles_per_second;
    float num_particles_to_emit;

    // ticks count (milliseconds) of the time when we last emitted particles
    unsigned time_of_last_emit; 

    float particle_col_r, particle_col_g, particle_col_b;
    float particle_life, particle_life_rand;
    float particle_size, particle_size_rand;
    float particle_life_decay, particle_life_decay_rand;
    float particle_size_decay, particle_size_decay_rand;

    bool use_texturing;
    unsigned texture_id;

    bool flare_up;
};


#endif

